package com.sky.context;

public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 向线程中设置当前用户的id
     * */
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 从线程中获取当前用户的id
     * */
    public static Long getCurrentId() {
        return threadLocal.get();
    }

    /**
     * 从线程中删除当前用户的id
     * */
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
